package edu.nf.ch01.service;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * @author wangl
 * @date 2025/4/27
 */
public class Main {

    public static void main(String[] args) {
        //核心的上下文容器接口ApplicationContext
        //1. 基于XML初始化的ApplicationContext
        ApplicationContext context = new ClassPathXmlApplicationContext("beans.xml");
        //使用泛型从容器中获取Bean对象
        UserService service = context.getBean("studentService", UserService.class);
        //如果这个接口仅有一个实现类的时候，可以直接使用Class对象获取
        //UserService service2 = context.getBean(UserService.class);
        service.add();

    }
}